package com.lyj.io.module.sys.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lyj.io.common.utils.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 组织
 * @author: 李亚杰
 * @version: 1.0
 * @date: 2021/8/19 14:54
 */
@ApiModel("组织表")
@Data
@TableName("sys_org")
public class SysOrg implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 组织ID
     */
    @ApiModelProperty(value = "组织ID", example = "")
    @TableId(type = IdType.ASSIGN_ID)
    private String orgId;

    /**
     * 组织类型
     */
    @ApiModelProperty(value = "组织类型", example = "")
    private Integer orgType;

    /**
     * 组织名称
     */
    @ApiModelProperty(value = "组织名称", example = "")
    private String orgName;

    /**
     * 父组织id
     */
    @ApiModelProperty(value = "父组织id", example = "")
    private String parentOrg;

    /**
     * 创建者ID
     */
    @ApiModelProperty(value = "创建者ID", example = "")
    private Long creater;

    /**
     * 状态
     */
    @ApiModelProperty(value = "状态", example = "")
    private Integer status;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间", example = "")
    @TableField(value = "CREATE_DATE", fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Date createDate;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间", example = "")
    @TableField(value = "UPDATE_DATE", fill = FieldFill.INSERT_UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Date updateDate;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注", example = "")
    private String remark;

    /**
     * 删除标识
     */
    @ApiModelProperty(value = "删除标识,默认为0", example = "")
    private String deleteFlag;

    /**
     * 是否有子部门
     */
    @ApiModelProperty(value = "是否有子部门", example = "")
    @TableField(exist = false)
    private Boolean hasChildren = true;

    /**
     * 子部门
     */
    @ApiModelProperty(value = "子部门", example = "")
    @TableField(exist = false)
    private List<SysOrg> children = new ArrayList<SysOrg>();

}
